using System.IO;
using System.Text;

namespace Synergy.IO.Extensions
{
	/// <summary>
	/// Static methods to extend the <see cref="Path"/> class.
	/// </summary>
	/// <remarks>
	///		<list type="table">
	///			<listheader><term>Version</term><description>Description</description></listheader>
	///			<item>
	///				<term>1.0</term>
	///				<description>Initial version</description>
	///			</item>
	///		</list>
	/// </remarks>
	public static class PathExtension
	{
		/// <summary>
		/// Combines the specified directories using the system <see cref="Path.DirectorySeparatorChar"/>.
		/// </summary>
		/// <param name="directories">The directories.</param>
		/// <returns>A full path using the system-defined path separator.</returns>
		public static string Combine(params string[] directories)
		{
			var path = new StringBuilder();
			for (var i = 0; i < directories.Length; i++)
			{
				if (i > 0)
				{
					path.Append(Path.DirectorySeparatorChar);
				}
				path.Append(directories[i]);
			}
			return path.ToString();
		}
	}
}